<?php
namespace Admin\Controller;
use Think\Controller;

class UserController extends Controller {
    //会员列表页
    public function index(){
        $model = D('User');
        $data = $model->fPage();
        $this->assign(array(
            'data' => $data['data'],
            'page' => $data['page'],
        ));
        $this->display();
    }

    public function edit($id){
        if(IS_POST){
            $model = D('UserDetail');
            if($model->create(I('post.'))){
                if($model->save() !== FALSE){
                    $this->success('修改成功',U('User/index'));
                }
            }
            $this->error($model->getError());
        }
        $data = M('User')->find($id);
        $vo = M('UserDetail')->where("u_id = $id")->find();
        $this->assign(array(
            'vo' => $vo,
            'data' => $data,
        ));
        $this->display();
    }
}